<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_sys_class('model', '', 0);
class goods_model extends model {

	public function __construct() {
		$this->db_config = pc_base::load_config('database');
        $this->goods_info = pc_base::load_model('goods_info_model');
		$this->db_setting = 'default';
		$this->table_name = 'goods';
		parent::__construct();
	}


    /**
     * 统计真实数量
     * @param $goods_id
     * @return mixed
     */
    public function getGoodsNum($goods_id){
        $where="is_deny=1 AND ";
        $where.= "goods_id IN($goods_id)";
        $result = $this->goods_info->get_one($where,"count(id) as total");
        return $result['total'];
    }
}
?>